{include file="public/header" /}
<title>论坛分类——{notempty name="list"}修改{else/ }添加{/notempty}</title>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
    <legend>论坛分类{notempty name="list"}修改{else/ }添加{/notempty}</legend>
</fieldset>



<form class="layui-form" action="" method="post" enctype="multipart/form-data">
    {notempty name="list"}<input type="hidden" name="id" value="{$list.id}">{/notempty}
    <div class="layui-form-item">
        <label class="layui-form-label">分类名称</label>
        <div class="layui-input-block">
            <input type="text" name="cate_name" required {notempty name="list"} value="{$list.cate_name}" {/notempty} lay-verify="required" placeholder="请输入分类名称" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">状态</label>
        <div class="layui-input-block">
            <select name="status" lay-verify="required">
                <option value=""></option>
                <option value="0" {notempty name="list"}{if $list.status == 0} selected {/if}{/notempty} >启用</option>
                <option value="1" {notempty name="list"}{if $list.status == 1} selected {/if}{/notempty}>未启用</option>
            </select>
        </div>
    </div>

    <div style="margin-left: 110px;">
        <input id="filed" name="cate_logo" type="file" {empty name="list"} required lay-verify="required" {/empty}  style="display:none;">
        <button type="button" class="layui-btn" id="my-img"><i class="layui-icon">&#xe67c;</i>上传LOGO</button>

        <div id="box" style="margin: 20px 0 20px 0">
            <img id="imgshow" {notempty name="list"} src="http://www.2021rbac.com/{$list.cate_logo}" {/notempty}/>
        </div>
    </div>


    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">分类简介</label>
        <div class="layui-input-block">
            <textarea name="cate_introduce" placeholder="请输入分类简介"  class="layui-textarea">{notempty name="list"}{$list.cate_introduce} {/notempty}
            </textarea>
        </div>
    </div>



    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>



<style>
    #box {
        width: 120px;
        height: 120px;

    }

    #imgshow {
        width: 100%;
        height: 100%;
    }
</style>



<script>
    $("#filed").change(function(){
        $("#imgshow").attr("src",URL.createObjectURL($(this)[0].files[0]));
    });

    $(document).ready(function(){
        $('#my-img').click(function(){
            $('#filed').click();
        });

    });
</script>

<script>
    //Demo
    layui.use('form', function(){
        var form = layui.form;

        //监听提交
        form.on('submit(formDemo)', function(data){

        });
    });
</script>
{include file="public/footer" /}
